﻿@model QLMB.ViewModels.InfoFlight

@{
    ViewBag.Title = "GetBestFight";
}

<h2>BANG GIA CAC CHUYEN BAY RE NHAT TRONG THANG</h2>
<h2>@ViewBag.NOIDI ====> @ViewBag.NOIDEN</h2>
<table>
    <tr>
        <th>Ngày</th>
        <th>Giờ khởi hành</th>
        <th>Giờ đến</th>
        <th>Giá vé</th>
    </tr>
    @for (int i = 0; i < 30; i++)
    {
        <tr>
            <td>
                @{string day = string.Format("{0:ddd dd MMM}", ViewBag.NGAY.AddDays(i));}
                @Html.Label(day)
            </td>
            @{var cb = ViewBag.GIATHANG[ViewBag.NGAY.AddDays(i)];}
            @if(cb != null)
            {
                <td>
                    @{string hour1 = string.Format("{0:hh:mm}", cb.NgayDi);}
                    @Html.Label(hour1)
                </td>
                <td>
                    @{string hour2 = string.Format("{0:hh:mm}", cb.NgayDen);}
                    @Html.Label(hour2)
                </td>    
                <td>
                    @if (Model.time == 0)
                    {
                        @Html.ActionLink((string)string.Format("{0:0,0}",cb.DUONGBAY.GiaCoBan - cb.DUONGBAY.GiaCoBan*cb.KhuyenMai/100) + " VND", "ListFight",
                            new
                            {
                                Sanbaydi = Model.Sanbaydi,
                                Sanbayden = Model.Sanbayden,
                                Ngaydi = ViewBag.NGAY.AddDays(i),
                                Ngayve = Model.Ngayve,
                                Loaive = Model.Loaive,
                                SoNguoiLon = Model.SoNguoiLon,
                                SoTreEm = Model.SoTreEm,
                                time = Model.time,
                                LoaiDVdi = Model.Loaidichvudi,
                                LoaiDVden = Model.Loaidichvuve,
                                MaCBdi = Model.MaChuyenBayDi,
                                MaCBden = Model.MaChuyenBayVe
                            })
                    }
                    else
                    {
                       @Html.ActionLink((string)string.Format("{0:0,0}", cb.DUONGBAY.GiaCoBan - cb.DUONGBAY.GiaCoBan * cb.KhuyenMai / 100) + "VND", "ListFight",
                            new
                            {
                                Sanbaydi = Model.Sanbaydi,
                                Sanbayden = Model.Sanbayden,
                                Ngaydi = Model.Ngaydi,
                                Ngayve = ViewBag.NGAY.AddDays(i),
                                Loaive = Model.Loaive,
                                SoNguoiLon = Model.SoNguoiLon,
                                SoTreEm = Model.SoTreEm,
                                time = Model.time,
                                LoaiDVdi = Model.Loaidichvudi,
                                LoaiDVden = Model.Loaidichvuve,
                                MaCBdi = Model.MaChuyenBayDi,
                                MaCBden = Model.MaChuyenBayVe
                            }) 
                    }
                </td>
            }
            else
            {
                <td>--:--</td>
                <td>--:--</td>
                <td>No Value</td>
                
            }
        </tr>
    }
</table>
